<template>
  <count-to
    :start-val="start"
    :end-val="endVal"
    :duration="duration"
    :decimals="decimals"
    :suffix="suffix"
  />
</template>

<script>
import { watch, ref } from 'vue';
export default {
	props : {
		startVal : {
			type : [String, Number],
			default : 0,
		},
		endVal : {
			type : [String, Number],
		},
		duration : {
			type : [String, Number],
			default : 1000,
		},
		decimals : {
			type : [String, Number],
			default : 2,
		},
		suffix : {
			type : String,
			default : '%',
		},
	},
	setup (ctx) {
		let start = ref(ctx.startVal);
		watch(() => ctx.endVal, (newVal,oldVal) => {
			start.value = oldVal;
		});
		return {
			start,
		};
	},
};
</script>

<style lang="scss" scoped></style>
